package service;

import java.util.List;

import dao.CrsDao;
import dao.StuDao;
import entity.Course;
import entity.Student;

public class CrsService {

	//查询服务
	/**
	 * 查找所用用户
	 * @return
	 * @throws ClassNotFoundException 
	 */
	public List<Course> findAll() throws ClassNotFoundException {
		CrsDao crsDao = new CrsDao();
		return crsDao.findAll();
	}
	
	public List<Course> findByNo(Integer sno) throws ClassNotFoundException {
		CrsDao crsDao = new CrsDao();
		return crsDao.findByNo(sno);
	}
	
	public List<Student> findByFullName(String name) throws ClassNotFoundException {
		StuDao stuDao = new StuDao();
		return stuDao.findByFullName(name);
	}
	
	public List<Student> findByAbstractName(String name) throws ClassNotFoundException {
		StuDao stuDao = new StuDao();
		return stuDao.findByAbstractName(name);
	}
	
	public void addInfo(String sname, String ssex, Integer sage, String sdept, Integer sclass) 
			throws ClassNotFoundException {
		StuDao stuDao = new StuDao();
		stuDao.addInfo(sname, ssex, sage, sdept, sclass);
	}
	
	public void updateInfo(Student student) 
			throws ClassNotFoundException {
		StuDao stuDao = new StuDao();
		stuDao.updateInfo(student);
	}
	
	public void deleteInfo(Integer sno) 
			throws ClassNotFoundException {
		StuDao stuDao = new StuDao();
		stuDao.deleteInfo(sno);
	}
}
